<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<title>示例3-6</title>
<script type="text/javascript">
  var str="Every man in the world! Every woman on earth!";
  
  patt=/man/g;
  str2=str.replace(patt,"person");
  document.write(str2+"<br />");
  
  patt=/(wo)?man/g;
  patt.compile(patt);
  str2=str.replace(patt,"person");
  document.write(str2);

</script>

</head>

<body>
</body>
</html>
